#include "UiPhoneBookWnd.h"
#ifndef MERGER_APP_TO_SHELL
	#include "SinoembedBlueToothApp.h"
	extern CSinoembedBlueToothApp theApp;
#else
	extern HINSTANCE g_SDHResModuleHandle;
#endif
//#include <InitGuid.h>
//#include <imaging.h>
//#include <wingdi.h>

UiPhoneBookWnd::UiPhoneBookWnd()
:m_firstEntry(TRUE)
{
}

UiPhoneBookWnd::~UiPhoneBookWnd()
{
}

BOOL UiPhoneBookWnd::InitUiWin(void)
{
	BOOL bRtn = FALSE;
	LoadiInterItem();
	return bRtn;
}

void UiPhoneBookWnd::PaintWin(HDC hdc, RECT* prcWin, RECT* prcUpdate)
{
//	m_PhoneBookWndBG->Draw(hdc, prcWin, false, false);
}

int UiPhoneBookWnd::OnLButtonDown(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonDown(fwKeys, xPos, yPos);

}

int UiPhoneBookWnd::OnLButtonUp(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonUp(fwKeys, xPos, yPos);

}

void UiPhoneBookWnd::LoadiInterItem()
{
//jdhuang 20120818
//	m_PhoneBookWndBG = ImagingHelper::GetImageObject(g_SDHResModuleHandle, 5065);
	RECT rtBtnPhoneBookWnd[] = 
	{
		140, 10, 211, 77,
		270, 10, 341, 77,
		400, 10, 471, 77,
		530, 10, 601, 77,
	};
	
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_ONE].SetPos(rtBtnPhoneBookWnd[PHONE_BOOK_WND_ONE].left, rtBtnPhoneBookWnd[PHONE_BOOK_WND_ONE].top,
					rtBtnPhoneBookWnd[PHONE_BOOK_WND_ONE].right-rtBtnPhoneBookWnd[PHONE_BOOK_WND_ONE].left,
					rtBtnPhoneBookWnd[PHONE_BOOK_WND_ONE].bottom-rtBtnPhoneBookWnd[PHONE_BOOK_WND_ONE].top);
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_ONE].SetID(2400);
#ifndef MERGER_APP_TO_SHELL
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_ONE].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1044, true));
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_ONE].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1045, true));
#else
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_ONE].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5044, true));
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_ONE].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5045, true));
#endif
	AddChild(&m_BtnPhoneBookWnd[PHONE_BOOK_WND_ONE]);

	m_BtnPhoneBookWnd[PHONE_BOOK_WND_TWO].SetPos(rtBtnPhoneBookWnd[PHONE_BOOK_WND_TWO].left, rtBtnPhoneBookWnd[PHONE_BOOK_WND_TWO].top,
					rtBtnPhoneBookWnd[PHONE_BOOK_WND_TWO].right-rtBtnPhoneBookWnd[PHONE_BOOK_WND_TWO].left,
					rtBtnPhoneBookWnd[PHONE_BOOK_WND_TWO].bottom-rtBtnPhoneBookWnd[PHONE_BOOK_WND_TWO].top);
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_TWO].SetID(2401);
#ifndef MERGER_APP_TO_SHELL
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_TWO].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1046, true));
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_TWO].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1047, true));
#else
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_TWO].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5046, true));
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_TWO].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5047, true));
#endif
	AddChild(&m_BtnPhoneBookWnd[PHONE_BOOK_WND_TWO]);

	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].SetPos(rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].left, rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].top,
					rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].right-rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].left,
					rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].bottom-rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].top);
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].SetID(2402);
#ifndef MERGER_APP_TO_SHELL
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1048, true));
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1049, true));
#else
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5048, true));
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5049, true));
#endif
	AddChild(&m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ALL]);
	
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].SetPos(rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].left, rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].top,
					rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].right-rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].left,
					rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].bottom-rtBtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].top);
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].SetID(2403);
#ifndef MERGER_APP_TO_SHELL
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1050, true));
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1051, true));
#else
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5050, true));
	m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5051, true));
#endif
	AddChild(&m_BtnPhoneBookWnd[PHONE_BOOK_WND_DEL_ONE]);
//List PhoneBook
	RECT rtPhoneBookList[]=
	{
		118, 92, 655, 404,//ListWnd 
		50,  2, 300, 40,//Name Label
		300,  2, 637, 40,//Number Comment
	};
	m_listPhoneBook.SetPos(rtPhoneBookList[0].left,rtPhoneBookList[0].top, 
		rtPhoneBookList[0].right - rtPhoneBookList[0].left, rtPhoneBookList[0].bottom - rtPhoneBookList[0].top);
	m_listPhoneBook.SetID(2404);
	m_listPhoneBook.EnableScrollBarV(true);
	m_listPhoneBook.EnableNotifyMessage(true);
	m_listPhoneBook.SetItemHeight(44);
	m_listPhoneBook.SetTextColor(RGB(255,255,255));
//	m_listPhoneBook.SetTextRect(&rtText);
	m_listPhoneBook.SetTextProperty(&rtPhoneBookList[1], &rtPhoneBookList[2], 28, 28);

	AddChild(&m_listPhoneBook);

}

BOOL UiPhoneBookWnd::InitImages()
{
	return TRUE;
}
void UiPhoneBookWnd::DeleteImages()
{
}